home *** CD-ROM | disk | FTP | other *** search
/ Freelog 125 / Freelog_MarsAvril2015_No125.iso / Musique / Quod Libet / quodlibet-3.3.0-installer.exe / bin / quodlibet / ext / events / jep118.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2014-12-31  |  2KB  |  39 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. import os
  5. from quodlibet import util
  6. from quodlibet.const import USERDIR
  7. from quodlibet.plugins.events import EventPlugin
  8. outfile = os.path.join(USERDIR, 'jabber')
  9. format = "<tune xmlns='http://jabber.org/protocol/tune'>\n <artist>%s</artist>\n <title>%s</title>\n <source>%s</source>\n <track>%d</track>\n <length>%d</length>\n</tune>"
  10.  
  11. class JEP118(EventPlugin):
  12.     PLUGIN_ID = 'JEP-118'
  13.     PLUGIN_NAME = _('JEP-118')
  14.     PLUGIN_DESC = _('Output a Jabber User Tunes file to ~/.quodlibet/jabber')
  15.     PLUGIN_ICON = 'gtk-save'
  16.     PLUGIN_VERSION = '0.13'
  17.     
  18.     def plugin_on_song_started(self, song):
  19.         if song is None:
  20.             
  21.             try:
  22.                 f = file(outfile, 'w')
  23.                 f.write("<tune xmlns='http://jabber.org/protocol/tune'/>")
  24.             except EnvironmentError:
  25.                 pass
  26.  
  27.             f.close()
  28.         else:
  29.             
  30.             try:
  31.                 f = file(outfile, 'wb')
  32.                 f.write(format % (util.escape(song.comma('artist')), util.escape(song.comma('title')), util.escape(song.comma('album')), song('~#track', 0), song.get('~#length', 0)))
  33.             except EnvironmentError:
  34.                 pass
  35.  
  36.             f.close()
  37.  
  38.  
  39.